<?php 
namespace app\common\model;
class ShareThumb extends Common{
	protected $insert = ['addtime'=>SYS_TIME];
	protected function getAddtimeAttr($value){
		return date('Y-m-d H:i', $value);
	}
	protected function getThumbAttr($value, $data){
		if(strpos($value,"http://") !== false){
			return $value;
		}
		else{
			return $value ? rtrim(APP_URL,"/").'/'.$value : '';
		}
	}
	protected function getAlldataAttr($value, $data){
        $arr = [4=>'海报',5=>'文章'];
        $data['addtime'] = date('Y-m-d H:i', $data['addtime']);
        $data['realname'] = model('AdminUser')->where('userid', $data['userid'])->value('realname');
        if(strpos($data['thumb'],"http://") === false){
			$data['thumb'] = $data['thumb'] ? rtrim(APP_URL,"/").$data['thumb'] : '';
		}
        $data['dealer'] = model('AdminUser')->get_dealer($data['userid']);
        trace($data['realname']);
		return $data;
    }
    protected function getDealerAttr($value, $data){
        return model('AdminUser')->get_dealer($data['userid']);
    }
}